1. Field of the Invention
The present invention generally relates to a method of computing partial cyclic redundancy checks (CRCs) and, more particularly, a method for computing partial CRCs in real time for variable length data blocks and packets.
2. Background Description
Reliable transmission of data typically involves computation of error detecting checks, such as cyclic redundancy checks (CRCs), to support a wide range of protocols and transmission mediums. For example, the iSCSI (Internet Small Computer Systems Interface) standard provides a mechanism for exchanging SCSI commands and data over TCP/IP (Transmission Control Protocol/Internet Protocol). iSCSI defines a PDU (Protocol Data Unit) for the exchange between an iSCSI initiator and target. iSCSI PDUs may not be aligned to TCP segments or IP datagrams, because the TCP layer treats the data passed to and from an upper layer as a byte stream. Since TCP may break the byte stream at any arbitrary point, PDUs may not be aligned to TCP segments so that portions of PDUs may appear within a TCP segment. The iSCSI standard defines a CRC32 check to verify the integrity of PDU headers and data payloads.
One difficulty in computing CRC remainders is that portions of a PDU may arrive out of order from the network. The out of order delivery is a result of the underlying TCP/IP protocols used to transfer iSCSI PDUs. Traditional implementations of generating CRC remainders depend on the data being processed in order. The result of these behaviors of TCP/IP is that portions of an iSCSI PDU may be contained in different Ethernet packets which may arrive out of order. It is typically more difficult for hardware to compute the CRC when Ethernet frames (or similar frames) arrive out of order. The CRC algorithm itself creates part of the problem because the CRC result for a byte of data is dependent on all prior bytes over which the CRC is protecting. Thus, the CRC computation is not associative. The second factor is that the iSCSI PDUs are not aligned within any of the lower level portions of the protocol. Thus, a PDU boundary may occur anywhere within the data portion of a TCP segment and hence in the lower layers as well.
Another factor impacting the CRC generation is the increasing speed of networks. At higher speeds there is less time to process each packet. This has resulted in a number of approaches to offload the TCP/IP processing from the host onto specialized hardware and/or other processors. These approaches also minimize the number of times data is moved within a system. Ideally, the CRC generation should be accomplished as part of the other packet handling requirements.
Computing the CRC after all the parts of a PDU have been received consumes additional memory and bus bandwidth. Computing CRCs on the fly or in real time as PDUs arrive would be more efficient and flexible.